package com.smartrobot.smartrobot.pagerHolder;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.RelativeLayout;

import com.smartrobot.smartrobot.R;
import com.smartrobot.smartrobot.activity.ActiveActivity;
import com.smartrobot.smartrobot.activity.EducationActivity;
import com.smartrobot.smartrobot.activity.FashionActivity;
import com.smartrobot.smartrobot.activity.ProductActivity;
import com.smartrobot.smartrobot.activity.ScheduleActivity;

public class InformationPagerHolder1 implements BasePagerHolder,View.OnClickListener{

    private Context context;
	private View view;
    private boolean isFirst = true;
    private RelativeLayout product,active,detail,fashion,education;

	public InformationPagerHolder1(Context context, View view) {

        this.context = context;
        this.view = view;
	} 
	
	@Override
	public void setView(View view) {
		this.view = view;
	}

	@Override
	public View getView() {
		return view;
	}


    public void initView(){
        if(isFirst){
            isFirst = false;
            product = (RelativeLayout)view.findViewById(R.id.main_information_product);
            active = (RelativeLayout)view.findViewById(R.id.main_information_active);
            detail = (RelativeLayout)view.findViewById(R.id.main_information_detail);
            fashion = (RelativeLayout)view.findViewById(R.id.main_information_fashion);
            education = (RelativeLayout)view.findViewById(R.id.main_information_education);


            product.setOnClickListener(this);
            active.setOnClickListener(this);
            detail.setOnClickListener(this);
            fashion.setOnClickListener(this);
            education.setOnClickListener(this);
        }


    }


    @Override
    public void onClick(View view) {

        Intent intent = new Intent();

        switch (view.getId()){

            case R.id.main_information_product:


            intent.setClass(context, ProductActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);

                break;

            case R.id.main_information_active:
                intent.setClass(context, ActiveActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(intent);
                break;

            case R.id.main_information_detail:
                intent.setClass(context, ScheduleActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(intent);
                break;


            case R.id.main_information_fashion:
                intent.setClass(context, FashionActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(intent);
                break;


            case R.id.main_information_education:
                intent.setClass(context, EducationActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(intent);
                break;

        }

    }
}
